package com.jx.flowershopmanager.splash;

import android.content.Intent;
import com.jx.flowershopmanager.R;
import com.jx.flowershopmanager.base.BaseActivity;
import com.jx.flowershopmanager.home.HomeActivity;
import com.jx.flowershopmanager.login.LoginActivity;
import com.jx.flowershopmanager.util.SPUtils;

import java.util.Objects;

public class SplashActivity extends BaseActivity {

    @Override
    protected int layoutId() {
        return R.layout.activity_splash;
    }

    @Override
    protected void initView() {
        getWindow().setBackgroundDrawable(null);
    }

    @Override
    protected void initData() {
        SPUtils spUtils = new SPUtils(this,"user");
        String token = spUtils.getString("token");
        Intent intent;
        if (token != null){
            intent = new Intent(SplashActivity.this, HomeActivity.class);
            finish();
        }else {
            intent = new Intent(SplashActivity.this, LoginActivity.class);
            finish();
        }
        startActivity(intent);
    }
}